-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: resolve Claude CLI --system-prompt flag error by passing via stdin #6536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Remove --system-prompt command line argument for all platforms - Pass system prompt and messages together via stdin (like Windows) - Update tests to reflect unified stdin behavior across platforms - Fixes #6534 where Claude CLI was failing with exit code 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code is like debugging in production - technically possible but morally questionable. I've reviewed the changes and left some suggestions inline to improve clarity and maintainability.
| const isWindows = os.platform() === "win32" | ||
|
|
||
| // Build args based on platform | ||
| // Build args - no longer passing system prompt as command line argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment could be more descriptive about why we're making this change. Consider:
This would help future maintainers understand the reasoning behind this architectural decision.
| } else { | ||
| stdinData = JSON.stringify(messages) | ||
| } | ||
| // Pass both system prompt and messages via stdin for all platforms |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two comment lines could be consolidated for brevity:
| } | ||
|
|
||
| // On Windows, should NOT have --system-prompt in args | ||
| // Should NOT have --system-prompt in args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment references Windows-specific behavior that no longer exists. Could we update it to reflect the unified behavior?
| } | ||
|
|
||
| // On non-Windows, should have --system-prompt in args | ||
| // Should NOT have --system-prompt in args (same behavior for all platforms now) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - this comment still mentions platform differences that we've eliminated. Consider:
|
Not a proper fix, issue is not scoped |
Fixes #6534
Problem
Users were experiencing "Command failed with exit code 1: claude -p --system-prompt" errors when using the Claude Code provider. The issue was that the Claude CLI was failing when the
--system-promptflag was passed as a command-line argument on non-Windows systems.Solution
--system-promptcommand line argument for all platformsTesting
Impact
This fix resolves the error that was preventing users from using the Claude Code provider when it would try to pass the system prompt as a command line flag.
Important
Fixes Claude CLI error by passing system prompt via stdin instead of command line argument, ensuring consistent behavior across platforms.
--system-promptcommand line argument inrun.ts.runProcess().run.spec.tsto verify stdin behavior for all platforms.--system-promptis not in args and stdin receives correct data.run.ts.This description was created by
for 5ed7692. You can customize this summary. It will automatically update as commits are pushed.